// for class based (OO) access to ped functions

#pragma once
#include <windows.h>

#include "../../ScriptHook/ScriptingTypes.h"
#include "../../ScriptHook/Scripting.h"
#include "../ScriptingTypes.h"
#include "../ScriptingEnums.h"
#include "../Log.h"
#include "GameObject.h"
#include "Vehicle.h"
#include "Ped.h"
#include "../ObjectPool.h"
#include "../Events.h"


namespace GTA
{
	public ref class World
	{
	private:
		static void SearchPedsTick();
		static ObjectPool^ Peds;
		static u32 currentpedsearchid;

		static void SearchVehiclesTick();
		static ObjectPool^ Vehicles;
		static u32 currentvehiclesearchid;

		static void SearchObjectsTick();
		static ObjectPool^ Objects;
		static u32 currentobjectsearchid;
		
	public:
		World::World();
		static void RunTick(Object^ sender, EventArgs^ args);
		static void CleanUp(Object^ sender, GTA::Events::CleanUpEventArgs^ args);

		// -- util --
		static float GetDistance(Vector3^ coords1, Vector3^ coords2);
		// -- --

		// -- ped --
		static GTA::Ped^ World::CreatePed(GTA::eModel model,Vector3^ coordinates);
		static u32 FindNextPed(u32 starthandle);
		static array<Ped^>^ GetAllPeds();
		static array<Ped^>^ GetAllPedsInArea(Vector3^ loc, float dist);
		static Ped^ GetClosestPedInArea(Vector3^ loc, float area);
		static Collections::ArrayList^ GetPedsExclusions; // list of peds that are never returned by GetAllPeds methods
		static void AddGetPedsExclusion(GTA::Ped^ ped);
		static void RemoveGetPedsExclusion(GTA::Ped^ ped);
		// -- --

		// -- vehicle --
		static GTA::Vehicle^ World::CreateVehicle(GTA::eModel model,Vector3^ coordinates);
		static u32 FindNextVehicle(u32 starthandle);
		static array<Vehicle^>^ GetAllVehicles();
		static array<Vehicle^>^ GetAllVehiclesInArea(Vector3^ loc, float dist);
		static Vehicle^ GetClosestVehicleInArea(Vector3^ loc, float area);
		static Collections::ArrayList^ GetVehiclesExclusions; // list of vehs that are never returned by GetAllVehs methods
		static void AddGetVehiclesExclusion(GTA::Vehicle^ veh);
		static void RemoveGetVehiclesExclusion(GTA::Vehicle^ veh);
		// -- --

		// -- object --
		static GTA::GameObject^ World::CreateObject(GTA::eModel model,Vector3^ coordinates);
		static u32 FindNextObject(u32 starthandle);
		static array<GameObject^>^ GetAllObjects();
		static array<GameObject^>^ GetAllObjectsInArea(Vector3^ loc, float dist);
		static GameObject^ GetClosestObjectInArea(Vector3^ loc, float area);
		static Collections::ArrayList^ GetObjectsExclusions; // list of objs that are never returned by GetAllObjs methods
		static void AddGetObjectsExclusion(GTA::GameObject^ obj);
		static void RemoveGetObjectsExclusion(GTA::GameObject^ obj);
		// -- --


		// -- player aim -- todo: move somewhere else
		static GTA::GameObject^ CamObject;
		static GTA::GameObject^ AimObject;
		static void AimTick();
		static void AttachAim();
		static void DetachAim();
		static Vector3^ GetAimCoordinates(float distance);
		// -- --

	};
};